{{ if or .Site.Params.enableMathJax .Params.math }}
{{ partial "math.html" . }}
{{ end }}
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
<script>
    window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/highlight.min.js"></script>
{{- range .Site.Params.highlightjs.langs }}
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/{{.}}.min.js" defer></script>
{{- end -}}
<script>
    hljs.configure({
        tabReplace: '    ', // 4 spaces
        classPrefix: ''     // don't append class prefix
        // … other options aren't changed
    })
    hljs.initHighlightingOnLoad();
</script>
{{- $appjs := resources.Get "js/application.js" | resources.Minify | resources.Fingerprint}}
<script src="{{- $appjs.Permalink }}"></script>
{{- $plugin := resources.Get "js/plugin.js" | resources.Minify | resources.Fingerprint}}
<script src="{{- $plugin.Permalink }}"></script>

<script>
    (function (window) {
        var INSIGHT_CONFIG = {
            TRANSLATION: {
                POSTS: '{{ T "insight_posts"}}',
                PAGES: '{{ T "insight_pages"}}',
                CATEGORIES: '{{ T "insight_categories"}}',
                TAGS: '{{ T "insight_tags"}}',
                UNTITLED: '{{ T "insight_untitled"}}',
            },
            ROOT_URL: '{{ .Site.BaseURL }}',
            CONTENT_URL: '{{ print .Site.BaseURL "/searchindex.json" | safeURL }} ',
        };
        window.INSIGHT_CONFIG = INSIGHT_CONFIG;
    })(window);
</script>
{{- $insight := resources.Get "js/insight.js" | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{- $insight.Permalink }}" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script>
<script>
    tocbot.init({
        // Where to render the table of contents.
        tocSelector: '.js-toc',
        // Where to grab the headings to build the table of contents.
        contentSelector: '.js-toc-content',
        // Which headings to grab inside of the contentSelector element.
        headingSelector: 'h1, h2, h3',
        // For headings inside relative or absolute positioned containers within content.
        hasInnerContainers: true,
    });
</script>
{{- if eq .Type "repository" }}
{{- partial "_script/repository.html" . }}
{{- end}}
<!-- TODO books -->
{{- if .IsPage }}
{{- partial "_script/pv.html" . }}
{{- end }}
{{- if in $.Site.Params.mainSections .Type }}
{{- partial "_script/comment.html" . }}
{{- end }}
{{- partial "_script/fancybox.html" . }}
{{- partial "_script/analytics.html" . }}